<!-- @format -->

<template>
	<div class="ma-content-block  p-4">
		<div class="flex align_center" style="margin-bottom:12px">
			<div style="margin-right:8px;" @click="handlecolse">
				<icon-arrow-left size="40px" />
			</div>
			<div style="font-size:28px;line-height:40px">{{inforow?.dept.name}}</div>
		</div>
		<a-tabs @change="handletab">
			<a-tab-pane key="1">
				<template #title> <icon-calendar /> 常规货物 </template>
				<div style="display:flex;margin-bottom:1%" class="align_center justify_between">
					<div class="flex">
						<div style="display:flex;margin-right:20px;justify-content: center;">
							<div style="line-height:32px">合同号：</div>
							<a-select v-model="contract_no" :style="{width:'320px'}" placeholder="请选择合同号" @change="handleChange">
								<a-option v-for="(item,index) in contractList" :key="index" :value="item.contract_no">{{ item.name }}</a-option>
							</a-select>
						</div>
						<a-button @click="setFdsl(record)" type="outline" v-auth="['prediction:order:saves']">创建提货单</a-button>
					</div>
					<div class="flex">
						<a-tooltip content="请输入车号">
							<a-input v-model="formItem.car_no" placeholder="请输入车号" allow-clear style="width:200px;margin-right:16px;" />
						</a-tooltip>
						<a-tooltip content="请选择创建时间">
							<a-range-picker
							style="width:300px;margin-right:16px;"
							show-time
							:time-picker-props="{ defaultValue: ['00:00:00', '23:59:59'] }"
							format="YYYY-MM-DD HH:mm"
							@ok="handleOkTime"
							/>
						</a-tooltip>
						<a-button type="primary" style="margin-right:16px;" @click="handleSouSuo">搜索</a-button>
						<a-button @click="handleChongZhi">重置</a-button>
					</div>
				</div>
				<!-- CRUD 组件 -->
				<ma-crud
					@selection-change="setSelected"
					:selected-keys="idsCG?.value"
					:options="options"
					:columns="columnsCG"
					ref="crudRefCG"
				>
					<template #horizontal_position="{ record }">
						<div v-if="record?.warehouse_link != null">
							{{ record?.warehouse_link.horizontal_position }} -
							{{ record?.warehouse_link.release_position }} - {{ record?.warehouse_link.reaches_position }}
						</div>
						<div v-else></div>
					</template>
					<template #warehouse_id="{ record }">
						<a-tag color="blue" v-if="record?.warehouse_link != null">{{ record?.warehouse_link?.warehouse?.name }}</a-tag>
						<div v-else></div>
					</template>
					<template #goods_name={record}>
						<div>{{record.goods_name}}</div>
					</template>
					<!-- <template #tableBeforeButtons>
						<a-button @click="setFdsl(record)" type="outline"
							>创建提货单</a-button
						>
					</template> -->
					<template #operationBeforeExtend="{ record }">
						<!--  -->
						<a-link @click="handleModifyWeight(record)" v-if="((record?.weight_yu - 0) > 0)">更正件数/重量</a-link>
						<a-link @click="handlePandian(record)" >盘点</a-link>
					</template>
					<template #summaryCell="{ column, record, rowIndex }">
						{{
							column.dataIndex == "car_no"
								? "合计" : column.dataIndex == "weight" || column.dataIndex == "weight_yu" ? (record[column.dataIndex] - 0).toFixed(3)
								: record[column.dataIndex]
						}}
					</template>
				</ma-crud>
			</a-tab-pane>
			<a-tab-pane key="2">
				<template #title> <icon-calendar /> 精准货物 </template>
				<div style="display:flex;margin-bottom:1%" class="align_center justify_between">
					<div class="flex">
						<div style="display:flex;margin-right:20px;justify-content: center;">
							<div style="line-height:32px">合同号：</div>
							<a-select v-model="contract_no" :style="{width:'320px'}" placeholder="请选择合同号" @change="handleChange">
								<a-option v-for="(item,index) in contractList" :key="index" :value="item.contract_no">{{ item.name }}</a-option>
							</a-select>
						</div>
						<a-button @click="setFdsl(record)" type="outline" v-auth="['prediction:order:saves']">创建提货单</a-button>
					</div>
					<div class="flex">
						<a-tooltip content="请输入车号">
							<a-input v-model="formItem.car_no" placeholder="请输入车号" allow-clear style="width:200px;margin-right:16px;" />
						</a-tooltip>
						
						<a-tooltip content="请选择创建时间">
							<a-range-picker
							style="width:300px;margin-right:16px;"
							show-time
							:time-picker-props="{ defaultValue: ['00:00:00', '23:59:59'] }"
							format="YYYY-MM-DD HH:mm"
							@ok="handleOkTime"
							/>
						</a-tooltip>
						<a-button type="primary" style="margin-right:16px;" @click="handleSouSuo">搜索</a-button>
						<a-button @click="handleChongZhi">重置</a-button>
					</div>
				</div>
				<!-- CRUD 组件 -->
				<ma-crud
					@selection-change="setSelected"
					:selected-keys="idsJZ?.value"
					:options="options"
					:columns="columnsJZ"
					ref="crudRefJZ"
				>
					<template #horizontal_position="{ record }">
						<div v-if="record?.warehouse_link != null">
							{{ record?.warehouse_link.horizontal_position }} -
							{{ record?.warehouse_link.release_position }} - {{ record?.warehouse_link.reaches_position }}
						</div>
						<div v-else></div>
					</template>
					<template #warehouse_id="{ record }">
						<a-tag color="blue" v-if="record?.warehouse_link != null">{{ record?.warehouse_link?.warehouse?.name }}</a-tag>
						<div v-else></div>
					</template>
					<!-- <template #tableBeforeButtons>
						<a-button @click="setFdsl(record)" type="outline"
							>创建提货单</a-button
						>
					</template> -->
					<template #operationBeforeExtend="{ record }">
						<a-link @click="handleModifyWeight(record)" v-if="((record.weight_yu - 0) > 0)"><icon-list />更正件数/重量</a-link>
						<a-link @click="handlePandian(record)" >盘点</a-link>
					</template>
					<template #summaryCell="{ column, record, rowIndex }">
						{{
							column.dataIndex == "car_no"
								? "合计" : column.dataIndex == "weight" || column.dataIndex == "weight_yu" ? (record[column.dataIndex] - 0).toFixed(3)
								: record[column.dataIndex]
						}}
					</template>
				</ma-crud>
			</a-tab-pane>
			<a-tab-pane key="3">
				<template #title> <icon-calendar /> 集装箱 </template>
				<div style="display:flex;margin-bottom:1%" class="align_center justify_between">
					<div class="flex">
						<div style="display:flex;margin-right:20px;justify-content: center;">
							<div style="line-height:32px">合同号：</div>
							<a-select v-model="contract_no" :style="{width:'320px'}" placeholder="请选择合同号" @change="handleChange">
								<a-option v-for="(item,index) in contractList" :key="index" :value="item.contract_no">{{ item.name }}</a-option>
							</a-select>
						</div>
						<a-button @click="setFdsl(record)" type="outline" v-auth="['prediction:order:saves']">创建提货单</a-button>
					</div>
					<div class="flex">
						<a-tooltip content="请输入车号">
							<a-input v-model="formItem.car_no" placeholder="请输入车号" allow-clear style="width:200px;margin-right:16px;" />
						</a-tooltip>
						
						<a-tooltip content="请选择创建时间">
							<a-range-picker
							style="width:300px;margin-right:16px;"
							show-time
							:time-picker-props="{ defaultValue: ['00:00:00', '23:59:59'] }"
							format="YYYY-MM-DD HH:mm"
							@ok="handleOkTime"
							/>
						</a-tooltip>
						<a-button type="primary" style="margin-right:16px;" @click="handleSouSuo">搜索</a-button>
						<a-button @click="handleChongZhi">重置</a-button>
					</div>
				</div>
				<!-- CRUD 组件 -->
				<ma-crud
					@selection-change="setSelected"
					:selected-keys="idsJZX?.value"
					:options="options"
					:columns="columnsJZX"
					ref="crudRefJZX"
				>
					<template #horizontal_position="{ record }">
						<div v-if="record?.warehouse_link != null">
							{{ record?.warehouse_link.horizontal_position }} -
							{{ record?.warehouse_link.release_position }} - {{ record?.warehouse_link.reaches_position }}
						</div>
						<div v-else></div>
					</template>
					<template #warehouse_id="{ record }">
						<a-tag color="blue" v-if="record?.warehouse_link != null">{{ record?.warehouse_link?.warehouse?.name }}</a-tag>
						<div v-else></div>
					</template>
					<!-- <template #tableBeforeButtons>
						<a-button @click="setFdsl(record)" type="outline"
							>创建提货单</a-button
						>
					</template> -->
					<template #operationBeforeExtend="{ record }">
						<a-link @click="handleModifyWeight(record)" v-if="((record.weight_yu - 0) > 0)"><icon-list />更正件数/重量</a-link>
						<a-link @click="handlePandian(record)" >盘点</a-link>
					</template>
					<template #summaryCell="{ column, record, rowIndex }">
						{{
							column.dataIndex == "car_no"
								? "合计" : column.dataIndex == "weight" || column.dataIndex == "weight_yu" ? (record[column.dataIndex] - 0).toFixed(3)
								: record[column.dataIndex]
						}}
					</template>
				</ma-crud>
			</a-tab-pane>
		</a-tabs>

		<a-modal :mask-closable="false" 
			v-model:visible="tihuoShow"
			v-if="tihuoShow"
			:width="1200"
			title="创建提货订单"
			@cancel="handlefdslCancel"
			@ok="handlethBeforeOk"
		>
			
			<div style="display: flex; margin-bottom: 2%">
				
				<div class="flex_1 marr16" style="display: flex; align-items: center; flex: 1">
					<div>配送方式 ：</div>
					<!-- 'marginRight':'20px' -->
					<a-select
						v-model="pick_typeid"
						:style="{ flex: '1' }"
						placeholder="请选择"
					>
						<a-option
							v-for="item of pick_type"
							:value="item.key"
							:label="item.title"
							:disabled="item.disabled"
						/>
					</a-select>
				</div>
				<div class="flex_1" style="display: flex; align-items: center; flex: 1">
					<div>选择车辆 ：</div>
					<div style="flex: 1">
						<a-select v-model="drivers_id" placeholder="请选择" multiple>
							<a-option
								v-for="item of drivers.value"
								:value="item?.id"
								:label="item?.car_no"
							/>
						</a-select>
					</div>
				</div>
			</div>
			<div style="display: flex; margin-bottom: 2%;margin-top:2%;" >
				<div style="display: flex; align-items: center; ">
					<div style="margin-right:8px">是否分流：</div>
					<a-radio-group v-model="is_fenliu" :options="plainOptions" />
				</div>
			</div>
			<div style="display: flex; margin-bottom: 2%;margin-top:2%;" v-if="tab == 3">
				<div style="display: flex; align-items: center; ">
					<div style="margin-right:8px">是否还箱：</div>
					<a-radio-group v-model="is_retrun" :options="retrunOptions" />
				</div>
			</div>
			<div style="margin-bottom: 2%;margin-top:2%;" >
				<a-row class="grid-demo" style="margin-bottom: 2%;">
					<a-col :span="8" >
						<div style="display: flex;align-items: center;">
							<div style="margin-right: 2%;">收货手机：</div>
							<a-input v-model="delivery_mobile" style="flex:1;margin-right: 2%;" placeholder="请输入收货手机" allow-clear />
						</div>
					</a-col>
					<a-col :span="8">
						<div style="display: flex;align-items: center;">
							<div style="margin-right: 2%;">收货电话：</div>
							<a-input v-model="delivery_tel" style="flex:1;margin-right: 2%;" placeholder="请输入收货电话" allow-clear />
						</div>
					</a-col>
					<a-col :span="8">
						<div style="display: flex;align-items: center;">
							<div style="margin-right: 2%;">收货单位：</div>
							<a-input v-model="delivery_unit" style="flex:1;" placeholder="请输入收货单位" allow-clear />
						</div>
					</a-col>
				</a-row>
				<a-row class="grid-demo" >
					<a-col :span="24">
						<div style="display: flex;">
							<div style="margin-right: 8px;">收货地址：</div>
							<a-textarea v-model="delivery_address" style="flex:1;" placeholder="请输入收货地址" allow-clear/>
						</div>
					</a-col>
				</a-row>
			</div>
			<a-table
				:pagination="false"
				:bordered="{ wrapper: true, cell: true }"
				:columns="tihuoColumns"
				:data="tihuoList"
			>
				<template #goods_name="{rowIndex}">
					<div>{{tihuoList[rowIndex].goods_name}}</div>
				</template>
				<template #number="{rowIndex}">
					<div>{{tihuoList[rowIndex].number}}件/{{tihuoList[rowIndex].weight}}吨</div>
				</template>
				<template #warehouse_order_detail_id="{rowIndex}">
					<div v-if="tihuoList[rowIndex].warehouse_link != null">{{tihuoList[rowIndex].warehouse_link.warehouse.name}}/{{tihuoList[rowIndex].warehouse_link.horizontal_position}}-{{tihuoList[rowIndex].warehouse_link.release_position}}-{{tihuoList[rowIndex].warehouse_link.reaches_position}}</div>
					<div v-else></div>
				</template>
				<template #number_yu="{ rowIndex }">
					<input
						v-model="tihuoList[rowIndex].pick_number"
						type="text"
						class="input"
						v-if="tab == 1"
					/>
					<p>
						<a-tag style="margin-top: 5px" color="blue"
							>剩余件数：{{ tihuoList[rowIndex].number_yu }}</a-tag
						>
					</p>
				</template>
				<template #weight_yu="{ rowIndex }">
					<input
						v-model="tihuoList[rowIndex].pick_weight"
						type="text"
						class="input"
						v-if="tab == 1"
					/>
					<p>
						<a-tag style="margin-top: 5px" color="blue"
							>剩余吨数：{{ tihuoList[rowIndex].weight_yu }}</a-tag
						>
					</p>
				</template>
			</a-table>
		</a-modal>

		<a-modal :mask-closable="false"  v-model:visible="showUpload" title="确认提交" @cancel="handleCancelnumShow" :width="1000" :on-before-ok="handleConfirmnumShow">
            <div
				style="width: auto; padding: 24px 36px; box-sizing: border-box"
				id="crudContent"
			>
				<div
					style="display: flex; justify-content: center; margin-bottom: 40px"
				>
					<div style="font-size: 20px">{{ xuanzhongShangpin[0]?.dept?.name }}</div>
				</div>
				<div
					style="
						margin-bottom: 10px;
						display: flex;
						justify-content: space-between;
					"
				>
					<div>{{ dept_name }}提货：</div>
				</div>
				<div style="margin-bottom: 10px" class="table">
					<table
						style="width: 100%"
					>
						<tr style="display: flex">
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>车号</div>
							</td>
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>仓库位置</div>
							</td>
                            <td
								
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>品名</div>
							</td>
                            
							
							<td
                            v-if="xuanzhongShangpin[0]?.goods_type == 3"
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>集装箱</div>
							</td>
							<td
                                v-if="xuanzhongShangpin[0]?.goods_type == 3"
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>箱型箱类</div>
							</td>
							<td
                            
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>数量(件)</div>
							</td>
                            <td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>重量(吨)</div>
							</td>
							<!-- <td v-if="datas?.transport_type == 2" style="flex:1;display:flex;justify-content: center;align-items: center;"><div>重量(吨)</div></td> -->
						</tr>
						<tr
							v-for="(items, index) in xuanzhongShangpin"
							:key="index"
							style="display: flex"
						>
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.car_no }}</div>
							</td>
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.warehouseName }}</div>
							</td>
							<td
								
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>
									{{ items?.goods_name }}
								</div>
							</td>
							
							<td
                            v-if="xuanzhongShangpin[0]?.goods_type == 3"
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.box  }}</div>
							</td>
							<td
                            v-if="xuanzhongShangpin[0]?.goods_type == 3"
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.box_type }}</div>
							</td>
							
							<td
								
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.pick_number }}</div>
							</td>
                            <td
								
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.pick_weight }}</div>
							</td>
							<!-- <td v-if="item.prediction.transport_type == 2"  style="flex:1;display:flex;justify-content: center;align-items: center;"><div>{{ item.pick_weight }}</div></td> -->
						</tr>
					</table>
					
				</div>
				<div
					style="
						margin-bottom: 10px;
						display: flex;
						justify-content: space-between;
					"
				>
					<div>选中司机：</div>
					<div></div>
				</div>
				<div style="margin-bottom: 10px" class="table">
					<table style="width: 100%">
						<tr style="display: flex">
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>司机姓名</div>
							</td>
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>司机电话</div>
							</td>
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>司机车牌号码</div>
							</td>
						</tr>
						<tr style="display: flex" v-for="(items, index) in xuanzhongDrivers"
							:key="index">
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.driver.driver_name }}</div>
							</td>
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.driver.mobile }}</div>
							</td>
							<td
								style="
									flex: 1;
									display: flex;
									justify-content: center;
									align-items: center;
								"
							>
								<div>{{ items?.car_no }}</div>
							</td>
						</tr>
					</table>
				</div>
			</div>
        </a-modal>

		<a-modal :mask-closable="false"  v-if="showModify" v-model:visible="showModify" :title="`车号/件数/重量修改`" @cancel="handleCancelModify" :width="800" :on-before-ok="handleConfirmModify">
			<div style="display: flex; align-items: center; flex: 1;margin-bottom: 3%;">
				<div style="width: 120px;">当前总件数：</div>
				<div >{{modifyItem?.number}} 吨</div>
			</div>
			<div style="display: flex; align-items: center; flex: 1;margin-bottom: 3%;">
				<div style="width: 120px;">当前总重量：</div>
				<div >{{modifyItem?.weight}} 吨</div>
			</div>
			<div style="display: flex; align-items: center; flex: 1;margin-bottom: 3%;">
				<div style="width: 120px;">车号：</div>
				<a-input v-model="modifyCarNo" :style="{flex:1}" placeholder="请输入更正后车号" allow-clear />
			</div>
			<div style="display: flex; align-items: center; flex: 1;margin-bottom: 3%;">
				<div style="width: 120px;">更正件数：</div>
				<a-input v-model="modifyNumber" :style="{flex:1}" placeholder="请输入更正后的重量" allow-clear />
			</div>
			<div style="display: flex; align-items: center; flex: 1;margin-bottom: 3%;">
				<div style="width: 120px;">更正重量：</div>
				<a-input v-model="modifyWeight" :style="{flex:1}" placeholder="请输入更正后的重量" allow-clear />
			</div>
			<div class="justify_center" style="display: flex; align-items: center; flex: 1;margin-bottom: 3%;">
				<div style="color:red">提示：车号、件数、重量信息更正后，将同步更正该条数据对应的预报车号、件数、重量。</div>
			</div>
			
		</a-modal>


		<!--  盘点 -->
		<a-modal :mask-closable="false"  v-model:visible="pandianShow" :title="rowData?.dept?.name" :width="1000" @cancel="handleCancelPandian" :on-before-ok="handleConfirmPandian">
			<div class="font16 marbot16">基本信息</div>
			<div class="flex justify_center marbot12">
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">车号</div>
					<div class="font14 hei">{{rowData.car_no}}</div>
				</div>
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">合同号</div>
					<div class="font14 hei">{{rowData.contract_no}}</div>
				</div>
			</div>
			<div class="flex justify_center marbot12">
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">品名</div>
					<div class="font14 hei">{{rowData.goods_name}}</div>
				</div>
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">品名提货类型</div>
					<div class="font14 hei">{{rowData.goods_type == 1?'常规提货':rowData.goods_type == 2?'精准提货':'集装箱'}}</div>
				</div>
			</div>
			
			<div class="flex justify_center marbot12">
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">总件数（件）</div>
					<div class="font14 hei">{{rowData.number }}</div>
				</div>
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">总重量（吨）</div>
					<div class="font14 hei">{{rowData.weight}}</div>
				</div>
			</div>
			<div class="flex justify_center marbot12">
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">剩余件数（件）</div>
					<div class="font14 hei">{{rowData.number_yu }}</div>
				</div>
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">剩余重量（吨）</div>
					<div class="font14 hei">{{rowData.weight_yu}}</div>
				</div>
			</div>
			<div class="flex justify_center marbot12">
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">存放仓库</div>
					<div class="font14 hei">{{rowData.warehouse_link?.warehouse.name }}</div>
				</div>
				<div class="flex flex_1">
					<div class="font14 hui" style="width:120px">库位（横-纵-层）</div>
					<div class="font14 hei">{{rowData.warehouse_link?.horizontal_position}}-{{rowData.warehouse_link?.release_position}}-{{rowData.warehouse_link?.reaches_position}}</div>
				</div>
			</div>
			<div style='width:100%;height:1px;background:rgba(0,0,0,.15)'></div>
			<div  style='margin-top:3%'>
				<div class="marbot12">盘点后库位：</div>
				<div class='flex' style='align-items: center;margin-bottom:3%'>
					<a-select :style="{width:'200px',marginRight:'20px'}" v-model="warehouse_id" placeholder="请选择仓库" @change='handleChangeWarehouse'>
						<a-option v-for="(item,index) in warehouseArr" :key='index' :value="item.id" :label="item.name"></a-option>
					</a-select>
					<a-select :style="{width:'200px',marginRight:'20px'}" v-model="heng_id" placeholder="请选择仓库-横">
						<a-option v-for="(item,index) in hengArr" :key='index' >{{item.label}}</a-option>
					</a-select>
					<a-select :style="{width:'200px',marginRight:'20px'}" v-model="zong_id" placeholder="请选择仓库-纵">
						<a-option v-for="(item,index) in zongArr" :key='index' >{{item.label}}</a-option>
					</a-select>
					<a-select :style="{width:'200px'}" v-model="ceng_id" placeholder="请选择仓库-层">
						<a-option v-for="(item,index) in cengArr" :key='index' >{{item.label}}</a-option>
					</a-select>
				</div>
				<div class='flex' style='align-items: center;margin-bottom:3%'>
					<div class="flex_1 marr16">
						<div class="marbot12"><span style='color:red'>*</span>当前盘点库存件数：</div>
						<div style='flex:1'>
							<a-input placeholder="请输入库存件数" v-model='panNumber' allow-clear />
						</div>
					</div>
					<div class="flex_1 ">
						<div class="marbot12"><span style='color:red'>*</span>当前盘点库存重量：</div>
						<div style='flex:1'>
							<a-input placeholder="请输入库存重量" v-model='panWeight' allow-clear />
						</div>
					</div>
					
				</div>
				
				<div class='' style='margin-bottom:3%'>
					<div class="marbot12"><span style='color:red'>*</span>盘点说明：</div>
					<div style='flex:1'>
						<a-textarea placeholder="请输入盘点说明..." v-model='panDescribe' allow-clear/>
					</div>
					
				</div>
			</div>
		</a-modal>
	</div>
</template>
<script setup>
	import { ref, reactive,onMounted,defineEmits } from "vue";
	import warehouseUserDetail from "@/api/warehouse/warehouseUserDetail";
	import predictionOrder from "@/api/prediction/predictionOrder";
	import predictionOrderDetail from "@/api/prediction/predictionOrderDetail";
	import predictionAddress from "@/api/prediction/predictionAddress";
	import { Message } from "@arco-design/web-vue";
	import tool from "@/utils/tool";
	import commonApi from "@/api/common";
	import { useRouter } from 'vue-router'
	import { request } from "@/utils/request.js";
	// import * as common from '@/utils/common'
	import { success, info, error } from "@/utils/common";
	const emits = defineEmits(['handlecolse'])
	const router = useRouter()
	const crudRefCG = ref();
	const crudRefJZ = ref();
	const crudRefJZX = ref();
	const dept_id = ref(0);
	const nums = ref(0);
	let tab = 1;
	const idsCG = reactive([]);
	const idsJZ = reactive([]);
	const idsJZX = reactive([]);
	const tihuoColumns = ref([]);
	// let tihuoColumns = [];
	let tihuoList = [];
	let pick_type = [];
	let buff_type = [];
	let addresslist = [];
	const confirmShow = ref(false)
	const pandianShow = ref(false)
	const pick_typeid = ref();
	const dept_name = ref()
	const address_id = ref();
	const buff_typeid = ref();
	const drivers = reactive([]);
	const drivers_id = ref([]);
	const xuanzhongDrivers = ref([])
	const xuanzhongShangpin = ref([])
	const showUpload = ref(false)
	const addobj = reactive({
		lat: "",
		lng: "",
		delivery_mobile: "",
		delivery_address: "",
		delivery_tel: "",
		delivery_unit: "",
	});
	const rowData = ref({})
	let contractList = [];   //  合同列表
	const contract_no = ref();
	const tihuoShow = ref(false);
	const showModify = ref(false);
	const delivery_mobile = ref('');
	const delivery_address = ref('');
	const delivery_tel = ref('');
	const delivery_unit = ref('');
	const is_retrun = ref('1');
	const is_fenliu = ref('0');
	const plainOptions = ref([
		{label: '否', value: '0'},
		{label: '是', value: '1'}
	])
	const retrunOptions = ref([
		{label: '还箱', value: '1'},
		{label: '不还箱', value: '2'},
	])
	const modifyWeight = ref('');
	const modifyItem = ref({});
	const modifyNumber = ref('')
	const modifyCarNo = ref('')
	const warehouse_user_id = ref();
	const warehouseArr = ref([])
	const hengArr = ref([])
	const zongArr = ref([])
	const cengArr = ref([])
	const warehouse_id = ref()
	const heng_id = ref()
	const zong_id = ref()
	const ceng_id = ref()
	const panNumber = ref()
	const panWeight = ref()
	const panDescribe = ref()
	const inforow = ref()
	const formItem = ref({
		pageSize:10,
		car_no:'',
		created_at:'',
	})
	onMounted(()=>{
		handleWarehouse()

	})
	const handleSouSuo = ()=>{
		handlecontractList()
	}
	const handleChongZhi = ()=>{
		formItem.value = {
			pageSize:10,
			car_no:'',
			created_at:'',
		}
		setTimeout(() => {
			handlecontractList()
		}, 200);
	}
	const handlecolse = ()=>{
		formItem.value = {
			pageSize:10,
			car_no:'',
			created_at:'',
		}
		emits('handlecolse',false)
	}
	const handleOkTime = (dateString, date)=>{
		formItem.value.created_at = dateString
	}
	const handleWarehouse = ()=>{
		request({    //  获取公司列表
			url: 'warehouse/master/remote',
			method: 'post',
			data:{
				props: { label: "name", value: "id" },
				openPage: false,
			}
		}).then(res=>{
			console.log('res:',res)
			warehouseArr.value = res.data
		})
	}
	const handleChangeWarehouse = (e) =>{
		heng_id.value = ''
		zong_id.value = ''
		ceng_id.value = ''
		request({
			url: "warehouse/master/getNumberList?type=1&warehouse_master_id=" +  warehouse_id.value,
			data:{
				props: { label: "name", value: "id" },
				openPage: false,
			}
		}).then(res=>{
			hengArr.value = res.data
		})
		request({
			url: "warehouse/master/getNumberList?type=2&warehouse_master_id=" +  warehouse_id.value,
			data:{
				props: { label: "name", value: "id" },
				openPage: false,
			}
		}).then(res=>{
			zongArr.value = res.data
		})
		request({
			url: "warehouse/master/getNumberList?type=3&warehouse_master_id=" +  warehouse_id.value,
			data:{
				props: { label: "name", value: "id" },
				openPage: false,
			}
		}).then(res=>{
			cengArr.value = res.data
		})     
	}

	const open = (row) => {
		dept_name.value = row.dept.name
		warehouse_user_id.value = row.id;
		dept_id.value = row.dept_id;
		contract_no.value = ''
		inforow.value = row
    	// crudRefCG.value.crudSearchRef.resetSearch();
		// crudRefCG.value.requestData();
		handlecontractList()
	};
	const handlePandian = (row) =>{
		rowData.value = row
		if(row.warehouse_link != null){
			warehouse_id.value = row.warehouse_link.warehouse_id 
			heng_id.value = row.warehouse_link.horizontal_position 
			zong_id.value = row.warehouse_link.release_position 
			ceng_id.value = row.warehouse_link.reaches_position 
		}else{
			warehouse_id.value = ''
			heng_id.value = ''
			zong_id.value = ''
			ceng_id.value = ''
		}
		pandianShow.value = true
		console.log(pandianShow.value)
	}
	const handleCancelPandian = ()=>{
		pandianShow.value = false
		panNumber.value = ''
		panWeight.value = ''
		panDescribe.value = ''
	}
	const handleConfirmPandian = async ()=>{
		if(warehouse_id.value == '' || heng_id.value == '' || zong_id.value == '' || ceng_id.value == ''){
			return Message.error('请选择库存位置')
		}
		if(panNumber.value == ''){
			return Message.error('请输入库存件数')
		}
		if(panWeight.value == ''){
			return Message.error('请输入库存重量')
		}
		if(panDescribe.value == ''){
			return Message.error('请输盘点说明')
		}
		let res = await request({    //  获取公司列表
			url: 'warehouse/userDetail/inventory',
			method: 'put',
			data:{
				id:rowData.value.id,
				number:panNumber.value,
				weight:panWeight.value,
				warehouse_id:warehouse_id.value,
				horizontal_position:heng_id.value,
				release_position:zong_id.value,
				reaches_position:ceng_id.value,
				remark:panDescribe.value,
			}
		})
		if(res.code == 200){
			Message.success('盘点成功！')
			crudRefJZ.value.refresh();
			crudRefCG.value.refresh();
			crudRefJZX.value.refresh();
			pandianShow.value = false
			panNumber.value = ''
			panWeight.value = ''
			panDescribe.value = ''
			return true
		}else{
			Message.error(res.message)
			return false
		}
		
	}
	const handlecontractList = () =>{
		request({    //  获取公司列表
			url: 'system/userContract/remote',
			method: 'post',
			data:{
				props: { label: "name", value: "contract_no" },
				openPage: false,
				remoteOption: {
					sort: { contract_no: "desc" }, // 如果不指定排序方式，默认为正序排序
					select: ["contract_no", "name"],
					filter: {
						dept_id: ["=", dept_id.value],
					},
					relations: [],
				},
			}
		}).then(res=>{
				contractList = res.data
				// contract_no.value = res.data[0].contract_no || ''
				// crudRefCG.value.crudSearchRef.resetSearch();
				// crudRefCG.value.requestData();
				if (tab == 1) {
					tihuoColumns.value = [
						{
							title: "车号",
							dataIndex: "car_no",
							formType: "input",
						},
						{
							title: "合同号",
							dataIndex: "contract_no",
							formType: "input",
						},
						{
							title: "品名",
							align: "center",
							dataIndex: "goods_name",
							slotName:'goods_name'
						},
						{
							title: "仓储数量（件）/ 重量（吨）",
							dataIndex: "number",
							align: "center",
							slotName:'number'
						},
						{
							title: "仓储位置",
							dataIndex: "warehouse_order_detail_id",
							align: "center",
							slotName:'warehouse_order_detail_id'
						},
						{
							title: "提货数量（件）",
							dataIndex: "number_yu",
							align: "center",
							slotName: "number_yu",
						},
						{
							title: "提货重量（吨）",
							dataIndex: "weight_yu",
							align: "center",
							slotName: "weight_yu",
						},
					];
					crudRefCG.value.requestData();
				} else if (tab == 2) {
					tihuoColumns.value = [
						{
							title: "车号",
							dataIndex: "car_no",
							formType: "input",
						},
						{
							title: "合同号",
							dataIndex: "contract_no",
							formType: "input",
						},
						{
							title: "品名",
							align: "center",
							dataIndex: "goods_name",
							slotName:'goods_name'
						},
						{
							title: "仓储数量（件）/ 重量（吨）",
							dataIndex: "number",
							align: "center",
							slotName:'number'
						},
						{
							title: "仓储位置",
							dataIndex: "warehouse_order_detail_id",
							align: "center",
							slotName:'warehouse_order_detail_id'
						},
						{
							title: "提货数量（件）",
							dataIndex: "number_yu",
							align: "center",
							slotName: "number_yu",
						},
						{
							title: "提货重量（吨）",
							dataIndex: "weight_yu",
							align: "center",
							slotName: "weight_yu",
						},
					];
					crudRefJZ.value.requestData();
				} else if (tab == 3) {
					tihuoColumns.value = [
						{
							title: "车号",
							dataIndex: "car_no",
							formType: "input",
						},
						{
							title: "合同号",
							dataIndex: "contract_no",
							formType: "input",
						},
						{
							title: "箱号",
							align: "center",
							dataIndex: "box",
						},
						{
							title: "箱型箱类",
							align: "center",
							dataIndex: "box_type",
						},
						{
							title: "箱属",
							align: "center",
							dataIndex: "box_belong",
						},
						{
							title: "仓储重量（吨）",
							dataIndex: "weight",
							align: "center",
						},
					];
					crudRefJZX.value.requestData();
				}
		})
	};
	const handleChange = (res)=>{
		contract_no.value = res
		if (tab == 1) {
			tihuoColumns.value = [
				{
					title: "车号",
					dataIndex: "car_no",
					formType: "input",
				},
				{
					title: "合同号",
					dataIndex: "contract_no",
					formType: "input",
				},
				{
					title: "品名",
					align: "center",
					dataIndex: "goods_name",
					slotName:'goods_name'
				},
				{
					title: "仓储数量（件）/ 重量（吨）",
					dataIndex: "number",
					align: "center",
					slotName:'number'
				},
				{
					title: "仓储位置",
					dataIndex: "warehouse_order_detail_id",
					align: "center",
					slotName:'warehouse_order_detail_id'
				},
				{
					title: "提货数量（件）",
					dataIndex: "number_yu",
					align: "center",
					slotName: "number_yu",
				},
				{
					title: "提货重量（吨）",
					dataIndex: "weight_yu",
					align: "center",
					slotName: "weight_yu",
				},
			];
			idsCG.value = []
			crudRefCG.value.requestData();
		} else if (tab == 2) {
			tihuoColumns.value = [
				{
					title: "车号",
					dataIndex: "car_no",
					formType: "input",
				},
				{
					title: "合同号",
					dataIndex: "contract_no",
					formType: "input",
				},
				{
					title: "品名",
					align: "center",
					dataIndex: "goods_name",
					slotName:'goods_name'
				},
				{
					title: "仓储数量（件）/ 重量（吨）",
					dataIndex: "number",
					align: "center",
					slotName:'number'
				},
				{
					title: "仓储位置",
					dataIndex: "warehouse_order_detail_id",
					align: "center",
					slotName:'warehouse_order_detail_id'
				},
				{
					title: "提货数量（件）",
					dataIndex: "number_yu",
					align: "center",
					slotName: "number_yu",
				},
				{
					title: "提货重量（吨）",
					dataIndex: "weight_yu",
					align: "center",
					slotName: "weight_yu",
				},
			];
			idsJZ.value = [];
			crudRefJZ.value.requestData();
		} else if (tab == 3) {
			tihuoColumns.value = [
				{
					title: "车号",
					dataIndex: "car_no",
					formType: "input",
				},
				{
					title: "合同号",
					dataIndex: "contract_no",
					formType: "input",
				},
				{
					title: "箱号",
					align: "center",
					dataIndex: "box",
				},
				{
					title: "箱型箱类",
					align: "center",
					dataIndex: "box_type",
				},
				{
					title: "箱属",
					align: "center",
					dataIndex: "box_belong",
				},
				{
					title: "仓储重量（吨）",
					dataIndex: "weight",
					align: "center",
				},
			];
			idsJZX.value = [];
			crudRefJZX.value.requestData();
		}
	}
	const handlefdslCancel = () => {
		tihuoShow.value = false;
	};
	const addressChange = async (row) => {
		let aa = await predictionAddress.getAddressInfo({ id: row });
		addobj.delivery_mobile = aa.data.mobile;
		addobj.delivery_address = aa.data.address;
		addobj.delivery_tel = aa.data.tel;
		addobj.delivery_unit = aa.data.unit;
		addobj.lat = aa.data.lat;
		addobj.lng = aa.data.lng;
	};
	const numberOperation = (newValue, id, numberName) => {
		warehouseUserDetail
			.numberOperation({ id, numberName, numberValue: newValue })
			.then((res) => {
				res.success && Message.success(res.message);
			})
			.catch((e) => {
				console.log(e);
			});
	};

	const switchStatus = (statusValue, id, statusName) => {
		warehouseUserDetail
			.changeStatus({ id, statusName, statusValue })
			.then((res) => {
				res.success && Message.success(res.message);
			})
			.catch((e) => {
				console.log(e);
			});
	};
	const handlethBeforeOk = async (e) => {
		if (drivers_id.value.length == 0) {
		  return Message.error('请选择司机')
		}
		let _data = [...tihuoList]
		let pick_number = 0
		let pick_weight = 0
		_data.map((v,i)=>{
			pick_number += (v.pick_number - 0)
			pick_weight += (v.pick_weight - 0)
			if(v.warehouse_link == null){
				v.warehouseName = ''
			}else{
				v.warehouseName = v.warehouse_link.warehouse.name + v.warehouse_link.horizontal_position + '-' + v.warehouse_link.release_position + '-' + v.warehouse_link.reaches_position
			}
			
		})
		pick_number = pick_number.toFixed(2)
		pick_weight = pick_weight.toFixed(3)
		_data.push({car_no:'合计',warehouseName:'',goods_name:'',box:'',box_type:'',pick_number,pick_weight})
		drivers.value.map((v,i)=>{
			drivers_id.value.map((vv,i)=>{
				if(vv == v.id){
					xuanzhongDrivers.value.push(v)
				}
			})
		})
		xuanzhongShangpin.value = _data
		showUpload.value = true
	};
	const handleCancelnumShow = ()=>{
		showUpload.value = false
	}
	const handleConfirmnumShow = async ()=>{
		let options = {
			item: tihuoList,
			leixing: {
				// butt: buff_typeid,
				pick: pick_typeid,
			},
			car_ids: drivers_id.value.join(","),
			delivery_mobile: delivery_mobile.value,
			delivery_address: delivery_address.value,
			delivery_tel: delivery_tel.value,
			delivery_unit: delivery_unit.value,
		}
		if(tab == 3){
			options.is_fenliu = is_fenliu.value
			options.is_retrun = is_retrun.value
		}
		let cc = await predictionOrder.save(options);
		if (cc.code == 200) {
			crudRefJZ.value.refresh();
			crudRefCG.value.refresh();
			crudRefJZX.value.refresh();
			emits('handlecolse',false)
			router.push('/prediction/order')
			Message.success("创建成功！");
			return true;
		} else {
			crudRefJZ.value.refresh();
			crudRefCG.value.refresh();
			crudRefJZX.value.refresh();
			Message.error("创建失败！");
			return false;
		}
	}
	const handletab = (index) => {
		tab = index;
		contract_no.value = ''
		handlecontractList()
	};
	const setSelected = (val) => {
		if (tab == 1) {
			idsCG.value = val;
		} else if (tab == 2) {
			idsJZ.value = val;
		} else if (tab == 3) {
			idsJZX.value = val;
		}
	};

	const setFdsl = (val) => {
		let keyArr = [];
		if (tab == 1) {
			if (idsCG.value.length == 0) {
				return error("请选择需要创建的常规货物！");
			}
			if (!contract_no.value) {
				return error("请选择合同号后再创建提货单！");
			}
			keyArr = idsCG.value.join(",");
			nums.value = idsCG.value.length;
		} else if (tab == 2) {
			if (idsJZ.value.length == 0) {
				return error("请选择需要创建的精准货物");
			}
			if (!contract_no.value) {
				return error("请选择合同号后再创建提货单！");
			}
			keyArr = idsJZ.value.join(",");
			nums.value = idsJZ.value.length;
		} else if (tab == 3) {
			if (idsJZX.value.length == 0) {
				return error("请选择需要创建的集装箱货物");
			}
			if (!contract_no.value) {
				return error("请选择合同号后再创建提货单！");
			}
			keyArr = idsJZX.value.join(",");
			nums.value = idsJZX.value.length;
		}

		warehouseUserDetail.getListByIds({ ids: keyArr }).then(async (res) => {
			tihuoList = res.data.items;
			tihuoList.map((v, i) => {
				v.pick_number = v.number_yu;
				v.pick_weight = v.weight_yu;
			});
			pick_type = await commonApi.getDict("pick_type");
			buff_type = await commonApi.getDict("butt_type");
			pick_type.data.map((v, i) => {
				if (v.key == 3 || v.key == 4) {
					v.disabled = false;
				}else{
					v.disabled = true;
				}
			});
			let ss = await predictionAddress.getAddressById({
				dept_id: dept_id.value,
			});
			addresslist = ss.data;
			pick_type = pick_type["data"];
			buff_type = buff_type["data"];
			addobj.delivery_mobile = "";
			addobj.delivery_address = "";
			addobj.delivery_tel = "";
			addobj.delivery_unit = "";
			delivery_mobile.value = "";
			delivery_address.value = "";
			delivery_tel.value = "";
			delivery_unit.value = "";
			is_fenliu.value = "0";
			is_retrun.value = "1";
			pick_typeid.value = "3";
			address_id.value = "";
			buff_typeid.value = "";
			drivers_id.value = [];
			predictionOrderDetail
				.getDrivers({ dept_id: dept_id.value,})
				.then((ress) => {
					ress.data.map((v,i)=>{
						v.car_no = v.car_no + '-' + v.driver.driver_name
					})
					drivers.value = ress.data;
					tihuoShow.value = true;
				});
		});
	};
	const handleModifyWeight = (row) =>{
		modifyItem.value = row
		modifyWeight.value = row.weight
		modifyNumber.value = row.number
		modifyCarNo.value = row.car_no
		showModify.value = true
	}
	const handleCancelModify = () =>{
		showModify.value = false
		modifyWeight.value = ''
		modifyNumber.value = ''
		modifyCarNo.value = ''
	}
	const handleConfirmModify = async () =>{
		if(!modifyWeight.value){
			return Message.error('请输入修改后的重量')
		}
		let res = await request({    //  获取公司列表
			url: 'warehouse/userDetail/update/' + modifyItem.value.id,
			method: 'put',
			data:{
				weight:modifyWeight.value,
				number:modifyNumber.value,
				car_no:modifyCarNo.value
			}
		})
		if(res.code == 200){
			Message.success('修改成功');
			if(tab == 1){
				crudRefCG.value.refresh()
			}else if(tab == 2){
				crudRefJZ.value.refresh()
			}else if(tab == 3){
				crudRefJZX.value.refresh()
			}
			showModify.value = false
			return true
		}else{
			Message.error(res.message);
			return false
		}
	}
	const options = reactive({
		id: "flyos_warehouse_user_detail",
		rowSelection: {
			showCheckedAll: true,
		},
		pk: "id",
		showTools: true,
		showIndex: true,
		autoRequest:false,
		operationColumnWidth:200,
		operationColumn: true,
		pageSizeOption:[10,20,50,100,200],
		showSummary: true,
		summary: [
			{
				dataIndex: "number",
				action: "sum",
			},
			{
				dataIndex: "weight",
				action: "sum",
			},
			{
				dataIndex: "number_yu",
				action: "sum",
			},
			{
				dataIndex: "weight_yu",
				action: "sum",
			},
		],
		formOption: {
			viewType: "modal",
			width: 600,
		},
		api: warehouseUserDetail.getList,
		recycleApi: warehouseUserDetail.getRecycleList,
		add: {
			show: false,
			api: warehouseUserDetail.save,
			auth: ["warehouse:userDetail:save"],
		},
		edit: {
			show: false,
			api: warehouseUserDetail.update,
			auth: ["warehouse:userDetail:update"],
		},
		delete: {
			show: false,
			api: warehouseUserDetail.deletes,
			auth: ["warehouse:userDetail:delete"],
			realApi: warehouseUserDetail.realDeletes,
			realAuth: ["warehouse:userDetail:realDeletes"],
		},
		recovery: {
			show: false,
			api: warehouseUserDetail.recoverys,
			auth: ["warehouse:userDetail:recovery"],
		},
		import: {
			show: false,
			url: "warehouse/userDetail/import",
			templateUrl: "warehouse/userDetail/downloadTemplate",
			auth: ["warehouse:userDetail:import"],
		},
		export: {
			show: false,
			url: "warehouse/userDetail/export",
			auth: ["warehouse:userDetail:export"],
		},
		beforeRequest: (params) => {
			params.warehouse_user_id = warehouse_user_id.value;
			params.goods_type = tab;
			params.contract_no = contract_no.value;
			params.car_no = formItem.value.car_no;
			params.created_at = formItem.value.created_at;
		},
		afterRequest: (params) => {
			let reg = new RegExp('[\u4E00-\u9FA5\uFE30-\uFFA0]');
			
			params.map((v, i) => {
				if (v.number_yu == 0) {
					v.disabled = true;
				} else {
					v.disabled = false;
				}
				if (reg.test(v.car_no)) {
					v.is_modify = true
				} else {
					v.is_modify = false
				}
				v.weight = (v.weight - 0).toFixed(3)
				v.weight_yu = (v.weight_yu - 0).toFixed(3)
			});
		},
	});

	let columnsCG = reactive([
		{
			title: "",
			dataIndex: "id",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			commonRules: {
				required: true,
				message: "请输入",
			},
		},
		
		{
			title: "车号",
			dataIndex: "car_no",
			formType: "input",
		},
		{
			title: "合同号",
			dataIndex: "contract_no",
			formType: "input",
		},
		{
			title: "品名",
			dataIndex: "goods_name",
			formType: "input",
		},
		{
			title: "品名提货类型",
			dataIndex: "goods_type",
			formType: "select",
			dict: {
				data: [
					{
						label: "普通提货",
						value: "1",
					},
					{
						label: "精准提货",
						value: "2",
					},
					{
						label: "集装箱",
						value: "3",
					},
				],
				translation: true,
			},
		},
		{
			title: "总件数",
			dataIndex: "number",
			formType: "input",
		},
		{
			title: "总重量",
			dataIndex: "weight",
			formType: "input",
		},
		{
			title: "剩余件数",
			dataIndex: "number_yu",
			formType: "input",
		},
		{
			title: "剩余总量",
			dataIndex: "weight_yu",
			formType: "input",
		},

		{
			title: "存放仓库",
			dataIndex: "warehouse_id",
			formType: "input",
		},

		{
			title: "仓位（横-纵-层）",
			dataIndex: "horizontal_position",
			formType: "input",
		},

		{
			title: "创建时间",
			dataIndex: "created_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			sortable: {
				sortDirections: ["ascend", "descend"],
				sorter: true,
			},
			showTime: true,
		},
		{
			title: "更新时间",
			dataIndex: "updated_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			showTime: true,
		},
		{
			title: "删除时间",
			dataIndex: "deleted_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			showTime: true,
		},
		{
			title: "创建者",
			dataIndex: "created_by",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
		},
		{
			title: "更新者",
			dataIndex: "updated_by",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
		},
	]);
	let columnsJZ = reactive([
		{
			title: "",
			dataIndex: "id",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			commonRules: {
				required: true,
				message: "请输入",
			},
		},
		
		{
			title: "车号",
			dataIndex: "car_no",
			formType: "input",
		},
		{
			title: "合同号",
			dataIndex: "contract_no",
			formType: "input",
		},
		{
			title: "品名",
			dataIndex: "goods_name",
			formType: "input",
		},
		
		{
			title: "品名提货类型",
			dataIndex: "goods_type",
			formType: "select",
			dict: {
				data: [
					{
						label: "普通提货",
						value: "1",
					},
					{
						label: "精准提货",
						value: "2",
					},
					{
						label: "集装箱",
						value: "3",
					},
				],
				translation: true,
			},
		},
		{
			title: "总件数",
			dataIndex: "number",
			formType: "input",
		},
		{
			title: "总重量",
			dataIndex: "weight",
			formType: "input",
		},
		{
			title: "剩余件数",
			dataIndex: "number_yu",
			formType: "input",
		},
		{
			title: "剩余总量",
			dataIndex: "weight_yu",
			formType: "input",
		},

		{
			title: "存放仓库",
			dataIndex: "warehouse_id",
			formType: "input",
		},

		{
			title: "仓位（横-纵-层）",
			dataIndex: "horizontal_position",
			formType: "input",
		},
		{
			title: "创建时间",
			dataIndex: "created_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			sortable: {
				sortDirections: ["ascend", "descend"],
				sorter: true,
			},
			showTime: true,
		},
		{
			title: "更新时间",
			dataIndex: "updated_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			showTime: true,
		},
		{
			title: "删除时间",
			dataIndex: "deleted_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			showTime: true,
		},
		{
			title: "创建者",
			dataIndex: "created_by",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
		},
		{
			title: "更新者",
			dataIndex: "updated_by",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
		},
	]);
	let columnsJZX = reactive([
		{
			title: "",
			dataIndex: "id",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			commonRules: {
				required: true,
				message: "请输入",
			},
		},
		{
			title: "车号",
			dataIndex: "car_no",
			formType: "input",
		},
		{
			title: "合同号",
			dataIndex: "contract_no",
			formType: "input",
		},
		{
			title: "品名提货类型",
			dataIndex: "goods_type",
			formType: "select",
			dict: {
				data: [
					{
						label: "普通提货",
						value: "1",
					},
					{
						label: "精准提货",
						value: "2",
					},
					{
						label: "集装箱",
						value: "3",
					},
				],
				translation: true,
			},
		},
		{
			title: "集装箱",
			dataIndex: "box",
			formType: "input",
		},
		{
			title: "箱型箱类",
			dataIndex: "box_type",
			formType: "input",
		},
		{
			title: "箱属",
			align: "center",
			dataIndex: "box_belong",
		},
		
		{
			title: "存放仓库",
			dataIndex: "warehouse_id",
			formType: "input",
		},

		// {
		//   title: "仓位ID",
		//   dataIndex: "warehouse_childs_id",
		//   formType: "input",
		//   search: true
		// },
		{
			title: "仓位（横-纵-层）",
			dataIndex: "horizontal_position",
			formType: "input",
		},
		{
			title: "件数",
			dataIndex: "number_yu",
			formType: "input",
		},
		{
			title: "重量",
			dataIndex: "weight_yu",
			formType: "input",
		},
		{
			title: "创建时间",
			dataIndex: "created_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			sortable: {
				sortDirections: ["ascend", "descend"],
				sorter: true,
			},
			showTime: true,
		},
		{
			title: "更新时间",
			dataIndex: "updated_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			showTime: true,
		},
		{
			title: "删除时间",
			dataIndex: "deleted_at",
			formType: "date",
			addDisplay: false,
			editDisplay: false,
			hide: true,
			showTime: true,
		},
		{
			title: "创建者",
			dataIndex: "created_by",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
		},
		{
			title: "更新者",
			dataIndex: "updated_by",
			formType: "input",
			addDisplay: false,
			editDisplay: false,
			hide: true,
		},
	]);
	const pandianColumns = [
		{
			title: '车号',
			dataIndex: 'car_no',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true
		},
		{
			title: '合同号',
			dataIndex: 'contract_no',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true
		},
		{
			title: '品名',
			dataIndex: 'goods_name',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true
		},
		
		{
			title: '品名提货类型',
			dataIndex: 'goods_type',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true,
			slotName:'goods_type',
		},
		{
			title: '总件数（件）',
			dataIndex: 'number',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true,
		},
		{
			title: '总重量（吨）',
			dataIndex: 'weight',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true,
		},
		{
			title: '剩余件数（件）',
			dataIndex: 'number_yu',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true,
		},
		{
			title: '剩余重量（吨）',
			dataIndex: 'weight_yu',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true,
		},
		{
			title: '存放仓库',
			dataIndex: 'warehouse_childs_id',
			width: 150,
			minWidth: 100,
			ellipsis:true,
			align:'center',
			tooltip:true,
			slotName:'warehouse_childs_id',
		},
		{
			title: '库位（横/纵/层）',
			dataIndex: 'horizontal_position',
			width: 150,
			minWidth: 100,
			align:'center',
			ellipsis:true,
			tooltip:true,
			slotName:'horizontal_position',
		},
	]
	tihuoColumns.value = [
		{
			title: "车号",
			dataIndex: "car_no",
			formType: "input",
		},
		{
			title: "合同号",
			dataIndex: "contract_no",
			formType: "input",
		},
		{
			title: "品名",
			align: "center",
			dataIndex: "goods_name",
			slotName:'goods_name'
		},
		{
			title: "仓储数量（件）/ 重量（吨）",
			dataIndex: "number",
			align: "center",
			slotName:'number'
		},
		{
			title: "仓储位置",
			dataIndex: "warehouse_order_detail_id",
			align: "center",
			slotName:'warehouse_order_detail_id'
		},
		{
			title: "提货数量（件）",
			dataIndex: "number_yu",
			slotName: "number_yu",
			align: "center",
		},
		{
			title: "提货重量（吨）",
			dataIndex: "weight_yu",
			slotName: "weight_yu",
			align: "center",
		},
	];
	defineExpose({ open });
</script>

<style>
.input {
	width: 100px;
	padding: 4px 12px;
	background: rgba(242, 243, 245);
	border: 1px solid rgba(242, 243, 245);
	border-radius: 4px;
	outline: none;
	/*清除input点击之后的黑色边框*/
}

.input:focus {
	background: #fff;
	border: 1px solid #1e80ff;
}
.table,
th,
tr,
td {
    padding: 0px;
    box-sizing: border-box;
    text-align: center;
    font-size: 14px;
    line-height: 20px;
}
.table {
    border-top: 1px solid rgba(0, 0, 0);
    border-left: 1px solid rgba(0, 0, 0);
    width: 100%;
}
.table td {
    padding: 6px 10px;
    word-break: break-all;
    word-wrap: break-word;
}
.table tr td {
    border-right: 1px solid rgba(0, 0, 0);
    border-bottom: 1px solid rgba(0, 0, 0);
}
</style>
<script>
	export default { name: "warehouse:userDetail" };
</script>
